package com.zhoug.zmui3demo.ui;

import android.graphics.Color;
import android.os.Bundle;
import android.widget.Button;

import com.zhoug.zmui3.chart.marker.PieMarker;
import com.zhoug.zmui3.chart.pie.PieEntry;
import com.zhoug.zmui3.chart.pie.ZMUIPieChartView;
import com.zhoug.zmui3demo.R;

import java.util.Arrays;

import androidx.appcompat.app.AppCompatActivity;

public class ZMUIPieChartActivity extends AppCompatActivity {
    private static final String TAG = ">>>ZMUIPieChartActivity";
    private static final boolean DEBUG=false;

    private ZMUIPieChartView mPieChartView;
    private Button mBtnStartAnim;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zmui_pie_chart);
        findViews();
        PieMarker pieMarker=new PieMarker(this,mPieChartView);
        pieMarker.setIntegerValue(true);
        mPieChartView.setMarker(pieMarker);
        mPieChartView.setEntries(Arrays.asList(
                new PieEntry(3000,"经营许可证"),
                new PieEntry(2000,"营业执照"),
                new PieEntry(4500,"许可证"),
                new PieEntry(250,"其它1"),
                new PieEntry(250,"其它2"),
                new PieEntry(250,"其它3"),
                new PieEntry(250,"其它4"),
                new PieEntry(250,"其它5"),
                new PieEntry(250,"其它6"),
                new PieEntry(250,"其它7"),
                new PieEntry(250,"其它8")

        ));
        mPieChartView.setColors(new int[]{Color.RED,Color.BLUE,Color.GREEN,Color.YELLOW});
        mPieChartView.startAnim(500);
        mBtnStartAnim.setOnClickListener(v->{
            mPieChartView.startAnim(500);
        });


    }


    private void findViews() {
        mPieChartView = findViewById(R.id.pieChartView);
        mBtnStartAnim = findViewById(R.id.btn_startAnim);

    }
}